package com.itrip.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itrip.entity.ItripOrderLinkUser;
import com.itrip.vo.order.ItripOrderLinkUserVo;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface ItripOrderLinkUserMapper extends BaseMapper<ItripOrderLinkUser>{
    @Select("<script> select\n" +
            "            linkUserId as linkUserId,\n" +
            "            linkUserName as linkUserName\n" +
            "    from itrip_order_link_user\n" +
            "    <trim prefix=\"where\" prefixOverrides=\"and | or\">\n" +
            "                <if test=\"id != null and id!=''\">\n" +
            "                    and id=#{id}\n" +
            "                </if>\n" +
            "                <if test=\"orderId != null and orderId!=''\">\n" +
            "                    and orderId=#{orderId}\n" +
            "                </if>\n" +
            "                <if test=\"linkUserId != null and linkUserId!=''\">\n" +
            "                    and linkUserId=#{linkUserId}\n" +
            "                </if>\n" +
            "                <if test=\"linkUserName != null and linkUserName!=''\">\n" +
            "                    and linkUserName=#{linkUserName}\n" +
            "                </if>\n" +
            "                <if test=\"creationDate != null and creationDate!=''\">\n" +
            "                    and creationDate=#{creationDate}\n" +
            "                </if>\n" +
            "                <if test=\"createdBy != null and createdBy!=''\">\n" +
            "                    and createdBy=#{createdBy}\n" +
            "                </if>\n" +
            "                <if test=\"modifyDate != null and modifyDate!=''\">\n" +
            "                    and modifyDate=#{modifyDate}\n" +
            "                </if>\n" +
            "    </trim>\n" +
            "     order by creationDate desc\n" +
            "    <if test=\"beginPos != null and beginPos!='' and pageSize != null  and pageSize !='' \">\n" +
            "        limit #{beginPos},#{pageSize}\n" +
            "    </if> </script>")
    public List<ItripOrderLinkUserVo> getItripOrderLinkUserListByMap(Map<String, Object> param);
    @Select("SELECT\n" +
            "        linkUserId\n" +
            "    FROM itrip_order_link_user\n" +
            "    WHERE orderId IN(SELECT\n" +
            "                         id\n" +
            "                     FROM itrip_hotel_order\n" +
            "                     WHERE orderStatus = '0')")
    public List<Long> getItripOrderLinkUserIdsByOrder();




}
